ApiServer: signature v3 to accept more formats#2893
Conversation
It does it by reusing the DateUtil helpers. DateUtil uses java.time.* as that one knows how to deal with timezones correctly. Signed-off-by: Yoan Blanc <yoan.blanc@exoscale.ch>
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✖debian. JID-2347 |
|
@blueorangutan package |
|
@rafaelweingartner a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2352 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-3082)
|
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✖centos7 ✖debian. JID-2382 |
|
@blueorangutan package |
|
@DaanHoogland sorry lab's down, BO queue will be stuck for a while. |
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✖centos6 ✔centos7 ✔debian. JID-2395 |
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2396 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-3135)
|
|
@DaanHoogland @rhtyd @greut @Test
public void zonedTimeFormatIsoNoColonZMs() throws ParseException {
Date time = new Date();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ");
String str = OffsetDateTime.now().format(formatter);
Date dtParsed = DateUtil.parseTZDateString(str);
assertEquals(str, time.toString(), dtParsed.toString());
}This unittest is obviously buggy. Because there are two times when objects are used to get current DT, as a result, sometimes it fails. https://travis-ci.org/apache/cloudstack/jobs/450628551#L1047 Need a codefix or PR reverted and fixed. PR was merged recently. Now CS fails to build sometimes. |
|
Other tests in this PR also must be revised on similar behaviors. |
|
@bwsw You are right that these tests depend on hwclocktime and are not reliable. Any sugestions on how to fix without losing test-validity? |
|
@bwsw a quick hack of mine: ugly quick hack but should almost do what is intended without losing test quality or time skew bug as you reported. not sure how the nanoseconds must be handled yet. |
|
@DaanHoogland Looks good to me. May be imperfect, but should work, at least. |
|
well @bwsw the code needs debugging still. |
|
strangely this works: not sure if it is valid in all cases though, can you test @bwsw |
|
Tested on latest master: first tested running every test and passed successfully. Then replaced the last one for the code @DaanHoogland provided above and also succeeded |
|
@DaanHoogland |
Description
The format expected by
signatureVersion=3&expires=....is quite limited.It should accepts the following formats that are containing a timezone and/or milliseconds.
afaik only
2018-10-01T08:12:14+0100is accepted by the current codebase.This PR echoes another pull requests I made earlier this year. #2392 and #2867
Types of changes
GitHub Issue/PRs
n/a
Screenshots (if appropriate):
n/a
How Has This Been Tested?
the Java unit tests. If anyone want to help with the marvin work... cs does it already.
Checklist:
Testing